package phototour3.client;


import java.util.List;




public class Photo {
	
	private double latitude;
	
	private double longitude;

	private String photoName;

	private String url_ubication;	
	
	private String hyperlink;
	
//	private List<String> tags;
	
	public Photo(){}
	
	public Photo(Double latitude, Double longitude) {
		this.latitude=latitude;
		this.longitude=longitude;
		
		
	}
	
	public Photo(Double latitude, Double longitude,String name,String url_ubication) {
		this.latitude=latitude;
		this.longitude=longitude;
		photoName=name;
		this.url_ubication=url_ubication;
		changeMediumToSmall();
	}
	
	public Photo(Double latitude, Double longitude,String name,String url_ubication,String hyperlink,List<String> tags) {
		this.latitude=latitude;
		this.longitude=longitude;
		photoName=name;
		this.url_ubication=url_ubication;
		this.hyperlink=hyperlink;
//		this.tags=tags;
		changeMediumToSmall();
	}
	

	
	public String getHyperlink() {
		return hyperlink;
	}

	public void setHyperlink(String hyperlink) {
		this.hyperlink = hyperlink;
	}
	
	public String getPhotoName() {
		return photoName;
	}

	public void setPhotoName(String photoName) {
		this.photoName = photoName;
	}

	public String getUrl_ubication() {
		return url_ubication;
	}

	public void setUrl_ubicacion(String url_ubication) {
		this.url_ubication = url_ubication;
	}

	public double getLatitude() {
		return latitude;
	}


	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}

	public double getLongitude() {
		return longitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
		
	}
	
	public boolean equals(Photo p){
		boolean res=false;
		res=(latitude==p.getLatitude() && longitude==p.getLongitude() &&
				photoName==p.photoName && url_ubication==p.getUrl_ubication());
		return res;
	}
	
	public void changeMediumToSmall(){
		String[] st=getUrl_ubication().split("medium");
		String newString="";
		for(int i=0;i<st.length;i++){
			if(i==0){
				newString+=st[i];
				newString+="small";		
			}else{
				newString+=st[i];
			}
			
		}
		setUrl_ubicacion(newString);
		
	}


}
